package com.zyl.blog.common.enums;
import lombok.Getter;

/**
 * @version v1.0
 * @ProjectName: Personal_Blog
 * @Package: com.zyl.common.core.enums
 * @ClassName: ResultCode
 * @Description:
 * @Author FinalFantasy
 * @Date 2025/2/14-13:38
 */
@Getter
public enum ResultCode implements StatusCode {
    /*-------------------- HTTP 标准状态码 --------------------*/
    SUCCESS(200, "操作成功"),
    BAD_REQUEST(400, "请求参数错误"),
    UNAUTHORIZED(401, "身份未认证"),
    FORBIDDEN(403, "无权限访问"),
    NOT_FOUND(404, "资源不存在"),
    INTERNAL_ERROR(500, "服务器内部错误"),

    /*==================== 客户端错误 (10000-19999) ====================*/
    /*-- 通用参数校验错误 (10000-10099) --*/
    PARAM_IS_INVALID(10000, "参数无效"),
    PARAM_IS_BLANK(10001, "参数为空"),
    PARAM_TYPE_BIND_ERROR(10002, "参数类型错误"),
    PARAM_NOT_COMPLETE(10003, "参数缺失"),
    CAPTCHA_ERROR(10004, "验证码错误"),

    /*-- 数据资源错误 (10100-10199) --*/
    DATA_NOT_EXIST(10100, "数据不存在"),
    DATA_ALREADY_EXISTS(10101, "数据已存在"),

    /*==================== 鉴权错误 (20000-29999) ====================*/
    LOGIN_USERNAME_INVALID(20000, "用户名无效"),
    LOGIN_PASSWORD_INVALID(20001, "密码错误"),
    LOGIN_STATUS_INVALID(20002, "账号被禁用"),
    TOKEN_BLANK(20003, "Token令牌为空"),
    TOKEN_INVALID(20004, "Token令牌无效"),
    PERMISSION_NO_ACCESS(20005, "无访问权限"),

    /*==================== 业务模块错误 (40000-49999) ====================*/
    /*-- 用户模块 (40000-40099) --*/
    ACCOUNT_NOT_EXIST(40000, "用户不存在"),
    ACCOUNT_USERNAME_DUPLICATE(40001, "用户名重复"),
    USERNAME_EXISTS(40002, "用户名已存在"),
    USERNAME_OR_PASSWORD_ERROR(40003, "用户名或密码错误"),

    /*-- 角色模块 (40100-40199) --*/
    ROLE_NOT_EXIST(40100, "角色不存在"),
    ROLE_NAME_DUPLICATE(40101, "角色名重复"),
    ROLE_IN_USE_BY_ACCOUNT(40102, "角色被账户使用"),
    ROLE_IN_USE_BY_PERMISSION(40103, "角色包含权限"),

    /*-- 权限模块 (40200-40299) --*/
    PERMISSION_NOT_EXIST(40200, "权限不存在"),

    /*-- 车间模块 (41000-41099) --*/
    ROOM_NOT_EXIST(41000, "车间不存在"),
    ROOM_NAME_DUPLICATE(41001, "车间名重复"),

    /*-- 点位模块 (41100-41199) --*/
    POSITION_NOT_EXIST(41100, "点位不存在"),
    POSITION_NAME_DUPLICATE(41101, "点位名重复"),
    POSITION_DELETE_FORBIDDEN(41102, "点位下存在传感器"),

    /*-- 传感器模块 (41200-41299) --*/
    SENSOR_NOT_EXIST(41200, "传感器不存在"),
    SENSOR_BOUND_FORBIDDEN(41201, "传感器已被绑定"),

    /*-- 报警模块 (42000-42099) --*/
    ALARM_CONTROL_ERROR(42000, "报警器操作失败"),
    ALARM_STATUS_CODE_ERROR(42001, "报警器状态码错误"),

    /*-- 阈值模块 (43000-43099) --*/
    THRESHOLD_UPPER_LOWER_EQUAL(43000, "阈值上下限相等");

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}